Skip to content

fix(install): honor ID_LIKE when selecting the driver install distro (EAI-7406)#116

Open
michaelroy-amd wants to merge 1 commit into
mainfrom
eai-7406-idlike-distro-match
Open

fix(install): honor ID_LIKE when selecting the driver install distro (EAI-7406)#116
michaelroy-amd wants to merge 1 commit into
mainfrom
eai-7406-idlike-distro-match

Conversation

@michaelroy-amd

Copy link
Copy Markdown
Member

Summary

rocm install driver selects a distro-specific install plan in build_driver_install_plan. It matched only the /etc/os-release ID field and ignored ID_LIKE, so Debian/Ubuntu-family and RHEL-rebuild derivatives that reuse their base version scheme (e.g. Pop!_OS, AlmaLinux) fell through to the unsupported_linux_dkms_plan — even though the OpenMPI and system-dependency plans in rocm_core::openmpi already resolve the package family via ID_LIKE. This is the EAI-7406 "Debian-to-Ubuntu/EL matching" defect.

Root cause

Exact (ID, VERSION_ID) matching with no ID_LIKE fallback. Verified against AMD's live docs (rocm.docs.amd.com, ROCm 7.2.x): the existing codename values (Debian 12→jammy, 13→noble) and EL repo paths were already correct — the gap was purely that non-exact-ID family members were never matched.

Fix (one file: apps/rocm/src/main.rs)

Add driver_plan_via_id_like, used only when the exact (ID, VERSION_ID) match fails (exact matches are untouched):

  • Ubuntu-family (ID_LIKE names ubuntu) reusing 22.04/24.04 → the Ubuntu apt plan (ubuntu/<codename> repo).
  • Debian-family (ID_LIKE names debian) at 12/13 → the Debian apt plan.
  • RHEL rebuilds (ID_LIKE names rhel, e.g. AlmaLinux) at an AMD-documented EL version → new DnfDriverDistro::Generic, served from the vendor-neutral el/ repo path with standard RHCK kernel commands.

dnf_repo_version_path is generalized to key on the major version (EL 8/10 use the major path, EL 9 the point release) — behavior-preserving for every previously-reachable RHEL/Oracle/Rocky input, and correct for EL rebuilds.

The fallback is gated to AMD-documented versions, so version-misaligned derivatives (Linux Mint 22, Kali) still fall through to unsupported rather than fabricating a repo URL.

Safety-critical exclusions (found by adversarial review)

Two independent adversarial reviewers caught two regressions in an earlier revision of this change; both are fixed and now covered by regression tests:

  • Oracle Linux advertises ID_LIKE=fedora (not rhel) and boots the UEK kernel. It is excluded from the EL fallback (gated on mentions("rhel") + an explicit ol/oracle guard) so it keeps its dedicated UEK flow and never gets RHCK kernel commands.
  • openSUSE Leap shares SLES's version scheme but has no SUSEConnect entitlement. The SUSE fallback branch was removed entirely so Leap stays unsupported instead of receiving a broken SLES plan.

A third fresh adversarial pass verified both fixes and found no new defects.

Known limitation (out of scope)

Ubuntu derivatives with their own version scheme that expose UBUNTU_CODENAME but a non-Ubuntu VERSION_CODENAME (e.g. Linux Mint wilma/22) are not matched here — matching them safely would require codename-preference logic beyond this fix and is left as a follow-up. They fail safe (unsupported).

Test plan

  • 8 new focused unit tests (Pop!_OS, LMDE, AlmaLinux 9.6/8.10, exact-precedence, version-mismatch stays unsupported, Oracle-off-arm stays unsupported, openSUSE Leap stays unsupported).
  • cargo test --workspace -- --test-threads=1: 1444 passed, 0 failed.
  • cargo clippy --all-targets -- -D warnings: clean.
  • cargo fmt --check: clean.
  • python scripts/smoke_local.py: ok.

Refs EAI-7406

`build_driver_install_plan` matched only the `/etc/os-release` `ID`
field, so Debian/Ubuntu-family and RHEL-rebuild derivatives that reuse
their base version scheme (e.g. Pop!_OS, AlmaLinux) fell through to the
`unsupported_linux_dkms_plan`, even though the OpenMPI and system
dependency plans in `rocm_core::openmpi` already resolve the family via
`ID_LIKE`.

Add an `ID_LIKE` fallback used only when the exact `(ID, VERSION_ID)`
match fails:
- Ubuntu-family (`ID_LIKE` names `ubuntu`) reusing 22.04/24.04 -> the
  Ubuntu apt plan (`ubuntu/<codename>` repo).
- Debian-family (`ID_LIKE` names `debian`) at 12/13 -> the Debian apt plan.
- RHEL rebuilds (`ID_LIKE` names `rhel`, e.g. AlmaLinux) at an
  AMD-documented EL version -> a new `DnfDriverDistro::Generic` served
  from the vendor-neutral `el/` repo path with standard RHCK kernel
  commands.

The fallback is gated to AMD-documented versions, so version-misaligned
derivatives (Linux Mint 22, Kali) still fall through to unsupported
rather than fabricating a repository URL. Oracle Linux (UEK kernel,
`ID_LIKE=fedora`) and openSUSE Leap (no SUSEConnect entitlement) are
excluded so they never receive a broken plan.

`dnf_repo_version_path` is generalized to key on the major version
(EL 8/10 use the major path, EL 9 the point release), which is
behavior-preserving for every previously-reachable RHEL/Oracle/Rocky
input and correct for EL rebuilds.

Refs EAI-7406

Signed-off-by: Michael Roy <michael.roy@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant